﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DepSoft.Helpers.iTunes.Elements;

namespace DepSoft.Helpers.iTunes.Writers
{
    public abstract class PlaylistWriter
    {
        #region Properties
        protected iTunesPlaylist Playlist { get; set; }
        protected string FileName { get; set; }
        #endregion

        #region Constructor
        public PlaylistWriter(string fileName, iTunesPlaylist playList)
        {
            //No * chars allowed inside the filename
            this.FileName = fileName.Replace("*", "_");
            this.Playlist = playList;
        }
        #endregion

        #region Public methods
        /// <summary>
        /// Writes the passed track to the current playlist file
        /// </summary>
        /// <param name="trackName">The display name details for the track</param>
        /// <param name="track">Typed reference for the track, providing additional data</param>
        public abstract void WriteTrack(string trackName, iTunesTrack track);

        /// <summary>
        /// Closes the file handle for the playlist being written
        /// </summary>
        public abstract void Close();
        #endregion
    }
}
